import request from '@/utils/request'

// 查询报表分类列表
export function listCategory(query) {
  return request({
    url: 'ldzl-rpt/rpt/category/list',
    method: 'get',
    params: query
  })
}

// 查询报表分类详细
export function getCategory(categoryId) {
  return request({
    url: 'ldzl-rpt/rpt/category/' + categoryId,
    method: 'get'
  })
}

// 查询报表分类树结构
export function getCategoryTree() {
  return request({
    url: 'ldzl-rpt/rpt/category/tree',
    method: 'get'
  })
}

// 根据分类获取报表列表
export function getReportByCategory(categoryId) {
  return request({
    url: 'ldzl-rpt/rpt/category/' + categoryId + '/reports',
    method: 'get'
  })
}

// 新增报表分类
export function addCategory(data) {
  return request({
    url: 'ldzl-rpt/rpt/category',
    method: 'post',
    data: data
  })
}

// 修改报表分类
export function updateCategory(data) {
  return request({
    url: 'ldzl-rpt/rpt/category',
    method: 'put',
    data: data
  })
}

// 删除报表分类
export function delCategory(categoryId) {
  return request({
    url: 'ldzl-rpt/rpt/category/' + categoryId,
    method: 'delete'
  })
}

// 报表关联分类
export function relateCategory(data) {
  return request({
    url: 'ldzl-rpt/rpt/category/relate',
    method: 'post',
    data: data
  })
} 